import request from '@/utils/request'

export default{
    getOrderList(searchModel){
        return request({
          url: '/order/list',
          method: 'get',
          params: {
            name: searchModel.name,
            type: searchModel.type,
            pageNo: searchModel.pageNo,
            pageSize: searchModel.pageSize
          }
        });
      },
      // 新增
      addOrder(order){
        return request({
          url: '/order',
          method: 'post',
          data: order
        });
      },
      // 修改
      updateOrder(order){
        return request({
          url: '/order',
          method: 'put',
          data: order
        });
      },
      // 保存角色数据
      saveOrder(order){
        if(order.id == null || order.id == undefined){
          return this.addOrder(order);
        }
        return this.updateOrder(order);
      },
      // 根据id查询
      getOrderById(id){
        return request({
          url: `/order/${id}`,
          method: 'get'
        });
      },
}
